package org.jeecg.modules.education.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.education.entity.Education;
import org.jeecg.modules.education.service.EducationService;
import org.jeecg.modules.politics.entity.PoliticsStatus;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 类的作用
 *
 * @author liujiamiao
 * @email 2544296058@qq.com
 * @date 2020-10-24 21:26
 */
@RestController
@RequestMapping("/education/education")
@Slf4j
@Api(tags = "学历接口")
public class EducationController {

    @Autowired
    private EducationService educationService;

    /**
     * 获取所有的学历
     * @return
     */
    @ApiOperation("获取所有的学历")
    @GetMapping("/list")
    public Result list(){
        List<Education> list = educationService.sortList();
        return Result.ok(list);
    }

    /**
     * 根据学历id获取学历信息
     * @param id
     * @return
     */
    @ApiOperation("根据学历id获取学历")
    @GetMapping("/info/{id}")
    public Result info(@ApiParam("学历id") @PathVariable("id")Integer id){
        Education education = educationService.getById(id);
        return Result.ok(education);
    }


}
